﻿<?php
include ("../lib/BLL/DonViCTDTBLL.php");
include ("../lib/BLL/DonViBLL.php");
include ("../lib/BLL/ChuongTrinhDaoTaoBLL.php");

$thongbao="";
$donvi_ctdtBLL= new DonViCTDTBLL();
$donviBLL = new DonViBLL();
$ctdtBLL = new ChuongTrinhDaoTaoBLL();

////////////////////////////////////////////////////////////////////////////////
if(isset($_POST['them'])){
    $id = $_POST['id'];
    $madv = $_POST['madv'];
    $mactdt = $_POST['mactdt'];
	$ngaybd = $_POST['ngaybd'];
	$tinhtrang = $_POST['tinhtrang'];
    
    $dv = new DonViCTDT();
    
    $dv -> setDonViCTDT($id,$mactdt,$madv,$ngaybd,$tinhtrang);
    $kq = $donvi_ctdtBLL->InsertDonViCTDT($dv);
        
    if($kq)
    {
        header("Location: ?muc=nhom3&modul=tbl_donvi_ctdt&action=dsdonvictdt");
    }  
}
/////////////////////////////////


$dsdonvi = $donviBLL->GetlistDonVi();
$smarty->assign('ds_donvi',$dsdonvi);

$dsctdt = $ctdtBLL->getAllCTDT();
$smarty->assign('ds_ctdt',$dsctdt);

////////////////////////////////////
$smarty -> assign('id',$id);
$smarty -> assign('madv',$madv);
$smarty -> assign('mactdt',$mactdt);
$smarty -> assign('ngaybd',$ngaybd);
$smarty -> assign('tinhtrang',$tinhtrang);

$smarty -> assign('thongbao',$thongbao);
$smarty -> assign('ds_dv_ctdt', $ds);
$smarty->display('nhom3/tbl_donvi_ctdt/insertdonvi_ctdt.tpl')
?>